﻿<navigation:Page x:Class="Wintellect.Touch.ListBoxScrolling"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
                 xmlns:SampleData="clr-namespace:Expression.Blend.SampleData.SampleDataSource" 
                 xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
                 xmlns:Touch="clr-namespace:Wintellect.Touch;assembly=Wintellect.Touch" 
                 mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
                 Title="ListBoxScrolling Page">
    <navigation:Page.Resources>
        <SampleData:SampleDataSource x:Key="SampleDataSource" d:IsDataSource="True"/>
        <DataTemplate x:Key="ItemTemplate">
            <StackPanel Background="#FF333333">
                <StackPanel.Resources>
                    <Style TargetType="TextBlock">
                        <Setter Property="Foreground" Value="#FF8F9B1F"/>
                    </Style>
                </StackPanel.Resources>
                <!--<Touch:GestureService.GestureListener>
                    <Touch:GestureListener DoubleTap="GestureListener_DoubleTap" />
                </Touch:GestureService.GestureListener>-->

                <CheckBox IsChecked="{Binding IsOn, Mode=TwoWay}"/>
                <TextBlock Text="{Binding Subtitle}"/>
                <TextBlock Text="{Binding Title}"/>
            </StackPanel>
        </DataTemplate>
    </navigation:Page.Resources>
    <Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource SampleDataSource}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <TextBlock Grid.Row="0" Text="Vertical:" Margin="5,15"/>
            <ListBox Grid.Row="1" x:Name="SampleListBox" ItemTemplate="{StaticResource ItemTemplate}" ItemsSource="{Binding Collection}" Background="#FF222222">
                <ListBox.ItemContainerStyle>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                    </Style>
                </ListBox.ItemContainerStyle>
                <i:Interaction.Behaviors>
        		    <Touch:ListBoxTouchScrollBehavior/>
        	    </i:Interaction.Behaviors>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel/>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
            </ListBox>
        </Grid>
        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <TextBlock Grid.Row="0" Text="Horizontal:" Margin="5,15"/>
            <ListBox Grid.Row="1" ItemTemplate="{StaticResource ItemTemplate}" ItemsSource="{Binding Collection}" Background="#FF222222">
                <ListBox.ItemContainerStyle>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                    </Style>
                </ListBox.ItemContainerStyle>
                <i:Interaction.Behaviors>
                    <Touch:ListBoxTouchScrollBehavior/>
                </i:Interaction.Behaviors>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
            </ListBox>
        </Grid>
    </Grid>
</navigation:Page>
